package com.springboot.tools.action;

import java.sql.*;
import java.util.*;

import com.opensymphony.xwork2.ActionSupport;
import com.springboot.tools.dao.Db;

public class KeyAction extends ActionSupport {
    private static final long serialVersionUID = 1L;

    public List ListgetName(String key) throws SQLException {
        Db db = new Db();
        ResultSet rs = db.getKeyWord(key);
        List list = new ArrayList();
        ResultSetMetaData md = rs.getMetaData();
        int columnCOunt = md.getColumnCount();
        while (rs.next()) {
            Map rowData = new HashMap();
            for (int i = 1; i <= columnCOunt; i++) {
                rowData.put(md.getCatalogName(i), rs.getObject(i));
            }
            list.add(rowData);
        }
        return list;
    }
}
